package com.example.zg3_park.User

import androidx.lifecycle.MutableLiveData
import com.example.lib_base.entity.LoginEntity
import com.example.lib_base.mvvm.BaseViewModel
import com.example.lib_base.net.ApiService
import dagger.hilt.android.lifecycle.HiltViewModel
import javax.inject.Inject

@HiltViewModel
class UserViewModel @Inject constructor(val apiService:ApiService):BaseViewModel() {
    val loginData = MutableLiveData<LoginEntity>()
    val registerData = MutableLiveData<LoginEntity>()

    fun login(username:String,pwd:String) {
        httpRequest({ apiService.login(username, pwd) },loginData::postValue)
    }

    fun register(username:String,password:String) {
        httpRequest({ apiService.register(username, password) },registerData::postValue)
    }
}